<%--
  Created by IntelliJ IDEA.
  User: Du Shun Chang
  Date: 2022/4/22
  Time: 9:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%
    String username = request.getParameter("username");
    String password = request.getParameter("password");

    if (username.equals("admin") && password.equals("123")) {
//            System.out.println("我进入到登录方法中");
        System.out.println(username + "  " + password);
        response.sendRedirect("success.jsp");//重定向到success.jsp
    } else {
        request.getRequestDispatcher("error.jsp").forward(request, response);//转发到error.jsp
        request.setAttribute("msg", "账户或密码错误");
    }

%>
</body>
</html>
